﻿using System;
using System.Data;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;
using AnyOffice.BIZ;

namespace AnyOffice.general.Event
{
    public partial class read_event : ModulePage
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                int eventId = (Request.QueryString["event_id"] == null) ? 0 : int.Parse(Request.QueryString["event_id"].ToString());
                this.ViewState["EventId"] = eventId;
                DataTable table = new EventDao().SelectByEventId(base.Conn, eventId);
                if (table.Rows.Count == 0)
                {
                    this.pnlMain.Visible = false;
                    this.litMessage.Text = base.ShowPromptClose("无记录");
                }
                else
                {
                    this.litSubject.Text = (table.Rows[0]["Subject"] != DBNull.Value) ? table.Rows[0]["Subject"].ToString() : "";
                    this.litUserName.Text = "<u title=\"部门：" + table.Rows[0]["DeptName"].ToString() + "\" style=\"CURSOR:hand\">" + table.Rows[0]["UserName"].ToString() + "</u>";
                    this.litAddTime.Text = (table.Rows[0]["AddTime"] != DBNull.Value) ? table.Rows[0]["AddTime"].ToString() : "";
                    this.litContent.Text = (table.Rows[0]["Content"] != DBNull.Value) ? table.Rows[0]["Content"].ToString() : "";
                    this.litViewCount.Text = (table.Rows[0]["ViewCount"] != DBNull.Value) ? table.Rows[0]["ViewCount"].ToString() : "";
                    string attachmentId = (table.Rows[0]["AttachmentId"] != DBNull.Value) ? table.Rows[0]["AttachmentId"].ToString() : "";
                    if ((this.litAttachment.Text = AttachmentBiz.Display(base.Conn, attachmentId)) != string.Empty)
                    {
                        this.pnlAttachment.Visible = true;
                    }
                    else
                    {
                        this.litAttachment.Text = "无";
                    }
                }
            }
        }





    }
}
